﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZCATSMes;

namespace shenyangZC.ATS
{
    class PackToATS
    {
        public PackToATS(ZC2ATS infoToATS, TrainInfo trainInfo, VOBC.ATPPackage atpPackage, bool isQuit)
        {
            infoToATS.TrainId = trainInfo.NIDTrain;
            infoToATS.Direction = (Byte)trainInfo.TrainDirection;
            infoToATS.Runmode = isQuit ? (Byte)RunMode.Out : (Byte)trainInfo.RunMode;
            infoToATS.PositionType  = (Byte)(trainInfo.HeadPosition is Section ? SectionOrSwitch.Section : SectionOrSwitch.Switch);
            infoToATS.PositionId = (UInt16)trainInfo.HeadPosition.ID;
            infoToATS.Offset = trainInfo.HeadOffset;
            infoToATS.Speed = (Byte)trainInfo.Speed;
            infoToATS.MAId = atpPackage.D_MATailId;
            infoToATS.MAType = atpPackage.D_MATailType;
            infoToATS.IsEmergent = false;
        }
    }
}
